#ifndef _GAMECLIENT_H_
#define _GAMECLIENT_H_

#include "../network/NetMgr.h"
#include "GameCommand.h"

class CNetMgr;

class CGameClient
{
private:
	static const int MAX_COMMANDS = 10;

	CNetMgr *m_netMgr;
	int m_clientID;
	BOOL m_local;

	CGameCommand m_commands[MAX_COMMANDS];
	BOOL m_commandUsed[MAX_COMMANDS];
protected:
public:
	CGameClient(CNetMgr *netMgr, int clientID, BOOL local);
	~CGameClient();

	int getClientID() {return m_clientID;}
	BOOL isLocal() {return m_local;}

	//server reads a command from the client
	CGameCommand *readCommand(int time);

	//server writes a command to the local client
	BOOL writeCommand(CGameCommand *command);

	//network received a command and pushes it into the client
	BOOL pushCommand(CGameCommand *command);

	//discards commands older than time
	void flushCommands(int time);
};

#endif//_GAMECLIENT_H_

